package P3742;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Problema da disciplina de Estrutura de Dados e Complexidade de Algoritmos da
 * Pos Graduacao do Periodo 2011.1
 *
 * @see http://br.spoj.pl/problems/FEYNMAN/
 * @author Elenilson Vieira - 111100371 - elenilson[at]elenilsonvieira.com
 * @since 17 de abril de 2011
 */
public class Main {

    private static int[] memory = new int[100];

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        memory[0] = 1;

        while (true) {
            int sideSize = Integer.parseInt(reader.readLine().trim());

            if(sideSize == 0)
                break;
            
            System.out.println(countSquares(sideSize));
        }
    }

    private static int countSquares(int sideSize) {
        if(memory[sideSize - 1] != 0)
            return memory[sideSize - 1];

        return memory[sideSize - 1] = sideSize * sideSize + countSquares(sideSize - 1);
    }

}
